﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.Utils.Menu;

namespace FamilyTree_v1._0.User_Control
{
    public partial class UserMemberCard1 : UserControl
    {
        public UserMemberCard1()
        {
            InitializeComponent();         
        }
        public delegate void EventChangeSex();
        public EventChangeSex function_EventChangeSex;
        public delegate void EventAdd_Edit(object sender, EventArgs e);
        public EventAdd_Edit function_EventAdd_Edit;
        public delegate void EventDelete();
        public EventDelete function_EventDelete;
        private bool Sex=true;
        private bool Empty = false;
        public void setEmpty(bool empty)
        {
            Empty = empty;
        }
        public bool getEmpty()
        {
            return Empty;
        }
        public void setSex(bool sex)
        {
            Sex = sex;
        }
        public bool getSex()
        {
            return Sex;
        }
        public void setAvatar(string img)
        {
           Bitmap bmp = new Bitmap(img);
           pictureAvatar.Image = bmp;
        }
        public void setName(string Name)
        {
            labelName.Text = Name;   
        }
        public void setDateOfBirth(String dateOfBirth)
        {
            labelDateOfBirth.Text = "Ngày sinh: " + dateOfBirth;
        }
        public void setPlaceOfBirth(String placeOfBirth)
        {
            labelPlaceOfBirth.Text = "Nơi sinh: " + placeOfBirth;
        }

        private void UserMemberCard1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
                function_EventChangeSex();
        }
        private void labelName_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                function_EventAdd_Edit(sender,e);
            }
        }
        private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            function_EventDelete();
        }
        private void EditToolStripMenuItem_Click(object sender, EventArgs e)
        {
            function_EventAdd_Edit(sender,e);
        }
        public string getName()
        {
            return labelName.Text.Trim();
        }
    }
}
